<!-- loading组件 -->
<template>
  <div class="loading-box" v-show="isLoadingShow">
    <ul class="initial-keyframe">
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'Loading',

  components: {},

  model: {
    prop: 'isLoadingShowProp',
    event: 'updateLoadingShow',
  },

  props: {
    isLoadingShowProp: {
      type: Boolean,
      default: false,
    },
  },

  data() {
    return {}
  },

  computed: {
    isLoadingShow: {
      get() {
        return this.isLoadingShowProp
      },
      set(val) {
        this.$emit('updateLoadingShow', val)
      },
    },
  },

  watch: {},

  created() {},

  mounted() {},

  methods: {},
}
</script>

<style lang='scss' scoped>
$green: #3c9;
.loading-box {
  position: fixed;
  width: 100vw;
  height: 100vh;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 9999;

  background-color: rgba(204, 204, 204, 0.8);
  .initial-keyframe {
    position: relative;
    width: 100px;
    height: 100px;
    // background-color: rgba(204, 204, 204, 0.5);
    border-radius: 20%;
    li {
      list-style: none;
      position: absolute;
      left: 45px;
      top: 45px;
      border-radius: 100%;
      width: 10px;
      height: 10px;
      background-color: $green;
      animation: rotate 5s linear infinite;
      &:nth-child(2) {
        animation-delay: -1s;
      }
      &:nth-child(3) {
        animation-delay: -2s;
      }
      &:nth-child(4) {
        animation-delay: -3s;
      }
      &:nth-child(5) {
        animation-delay: -4s;
      }
      &:nth-child(6) {
        animation-delay: -5s;
      }
    }
  }
}
@keyframes rotate {
  from {
    transform: rotate(0) translate(-20px, 0) scale(1);
  }
  50% {
    transform: rotate(0.5turn) translate(-20px, 0) scale(2);
  }
  to {
    transform: rotate(1turn) translate(-20px, 0) scale(1);
  }
}
</style>
